<html>
<head><meta charset="utf-8"><title>default values · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default.20values.html">default values</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212972493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default%20values/near/212972493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default.20values.html#212972493">(Oct 11 2020 at 16:50)</a>:</h4>
<p>I was playing with some fancy features, and wanted to do:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1024</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">buf</span>: <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">N</span><span class="p">],</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>

<p>I don't know if there are any plans to have defaults like that.</p>



<a name="212974111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default%20values/near/212974111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> boats <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default.20values.html#212974111">(Oct 11 2020 at 17:35)</a>:</h4>
<p>i dont think its in the MVP but its certainly a reasonable feature</p>



<a name="212977361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default%20values/near/212977361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default.20values.html#212977361">(Oct 11 2020 at 19:03)</a>:</h4>
<p>I've been working on <a href="https://github.com/rust-lang/rust/pull/75384">https://github.com/rust-lang/rust/pull/75384</a>, but I've been a bit slow since there's stuff outside of Rust I've been working on. I've added a separate feature gate for it in the PR since I haven't checked whether it should be added to const_generics or not, but I can put it into <code>const_generics</code>/<code>min_const_generics</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>